Author: Francesco Ricci, UCLouvain, francesco.ricci@uclouvain.be, frankyricci@gmail.com
Warning: under development. Please if you find any bug or issues contact me.
Here you find how to use boltztrap2 directly through pymatgen. Examples of what it is possible to do with it and which quantities can be computed from the band structure are provided.
Boltztrap2 needs to be installed. Spin polarized is now implemented.
This notebook was tested with pymatgen == 2v2020.7.3. It should work with higher version too.
In [2]:
%notebook inline
In [ ]:
In [3]:
from pymatgen.electronic_structure.boltztrap2 import *
from monty.serialization import loadfn
In [4]:
data = VasprunLoader().from_file('boltztrap2_data/vasprun-PbTe_uniform_bs.xml')
In [5]:
bs = loadfn('boltztrap2_data/PbTe_bandstructure.json')
loader = BandstructureLoader(bs,data.structure)
In [6]:
vrun = Vasprun('boltztrap2_data/vasprun-PbTe_uniform_bs.xml',parse_projected_eigen=True)
data = VasprunBSLoader(vrun)
In [7]:
bs = vrun.get_band_structure()
nele = vrun.parameters['NELECT']
st = vrun.final_structure
data = VasprunBSLoader(bs,structure=st,nelect=nele)
In [8]:
data = VasprunBSLoader.from_file('boltztrap2_data/vasprun-PbTe_uniform_bs.xml')
In [9]:
# set curvature=False to speed up in case you do not need effective mass or hall coeficients
bztInterp = BztInterpolator(data,lpfac=10,energy_range=1.5,curvature=True)
In [10]:
sbs = bztInterp.get_band_structure()
list(sbs.bands.values())[0].shape
Out[10]:
In [11]:
from pymatgen.electronic_structure.plotter import BSPlotter
In [12]:
BSPlotter(sbs).show()
In [13]:
# define the path as a list
kpaths = [['L','K']]
# set the fractional coordinates of the kpoint as a dict
kp_lbl = {'L':np.array([0.5,0.5,0.5]),'K': np.array([0.375, 0.375, 0.75 ])}
sbs = bztInterp.get_band_structure(kpaths,kp_lbl)
BSPlotter(sbs).show()
In [14]:
tot_dos = bztInterp.get_dos()
len(tot_dos.energies)
Out[14]:
In [15]:
# set progress=True to show a progress bar
tot_proj_dos = bztInterp.get_dos(partial_dos=True,progress=False)
In [16]:
len(tot_proj_dos.get_spd_dos().values())
Out[16]:
In [17]:
from pymatgen.electronic_structure.plotter import DosPlotter
pltdos = DosPlotter(sigma=0.05)
pltdos.add_dos_dict(tot_proj_dos.get_element_dos())
pltdos.show()
In [18]:
# set fname argument to specify a different file name
bztInterp = BztInterpolator(data,lpfac=10,energy_range=1.5,curvature=True,
save_bztInterp=True,fname='bztInterp.json.gz')
len(bztInterp.coeffs)
Out[18]:
In [19]:
bztInterp = BztInterpolator(data,load_bztInterp=True,fname='bztInterp.json.gz')
len(bztInterp.coeffs)
Out[19]:
In [20]:
bztTransp = BztTransportProperties(bztInterp,temp_r = np.arange(300,1300,300))
In [42]:
print('\t'.join(['Temp', '\mu', 'rows', 'columns tensor']))
for p in bztTransp.Conductivity_mu, bztTransp.Seebeck_mu, bztTransp.Kappa_mu, \
bztTransp.Effective_mass_mu, bztTransp.Power_Factor_mu, bztTransp.Carrier_conc_mu:
print('\t'.join([str(i) for i in p.shape]))
In [22]:
bztTransp.compute_properties_doping(doping=10.**np.arange(16,23))
In [40]:
print('\t'.join(['Temp', 'Doping', 'rows', 'columns tensor']))
for p in bztTransp.Conductivity_doping, bztTransp.Seebeck_doping, bztTransp.Kappa_doping, \
bztTransp.Carriers_conc_doping,bztTransp.Effective_mass_doping, bztTransp.Power_Factor_doping:
print('\t'.join([str(i) for i in p['n'].shape]))
In [24]:
bztTransp = BztTransportProperties(bztInterp,temp_r = np.arange(300,1300,300), doping=10.**np.arange(16,23))
In [25]:
# set fname argument to specify a different file name
bztTransp = BztTransportProperties(bztInterp,temp_r = np.arange(300,1300,300), doping=10.**np.arange(16,23),
save_bztTranspProps=True,fname='bztTranspProps.json.gz')
In [26]:
bztTransp = BztTransportProperties(bztInterp,load_bztTranspProps=True,fname='bztTranspProps.json.gz')
In [28]:
bztPlotter = BztPlotter(bztTransp,bztInterp)
In [29]:
bztPlotter.plot_props('C','mu','temp')
Out[29]:
In [30]:
bztPlotter.plot_props('S','mu','temp',temps=[600,900,1200])
Out[30]:
In [31]:
bztPlotter.plot_props('S','doping','temp', temps=[600,900,1200], dop_type='p').show()
In [32]:
bztPlotter.plot_props('S','temp','doping',doping=[1e16,1e20], dop_type='n').show()
In [33]:
bztPlotter.plot_props('K','mu','temp',temps=[600,900,1200]).show()
In [34]:
bztPlotter.plot_props('H','mu','temp',temps=[600,900,1200]).show()
In [35]:
bztPlotter.plot_props('Po','doping','temp',temps=[600,900,1200],dop_type='p').show()
In [36]:
bztPlotter.plot_props('E','doping','temp').show()
In [37]:
bztPlotter.plot_props('Ca','mu','temp',temps=[600,900,1200]).show()
In [282]:
bztPlotter.plot_bands().show()
In [283]:
bztPlotter.plot_dos(T=200).show()